<template>
    <div>
      <el-scrollbar height="calc(100vh - 90px)">
        <el-form ref="form" :inline="true" :model="medicalRecordsFrom" :rules="rules">
          <div class="main-block">
            <el-row>
                <div class="top-title">住院病案首页</div>
            </el-row>
          </div>
        </el-form>
      </el-scrollbar>
    </div>
  </template>
  
  <script>
  import { mapGetters } from 'vuex'
  export default {
    name: 'medicalRecordsList',
    props: {
      medicalRecordsInfo:{
        default: {}
      },
      fromtype:{
        default: ''
      }
    },
    components:{
  
    },
    watch: {
      medicalRecordsInfo (now, old) {
        console.log(now, old)
        this.setMedincalRecordsFrom(now)
      }
    },
    data() {
      return {
        medicalRecordsFrom : {},
        readOnly: true,
        rules: {
          glh: [{ required: true, message: '住院流水号不能为空', trigger: 'blur' }],
          ylfkfs: [{ required: true, message: '医疗付费方式不能为空', trigger: 'blur' }],
          zycs: [{ required: true, message: '住院次数不能为空', trigger: 'blur' }],
          bah: [{ required: true, message: '病案号不能为空', trigger: 'blur' }],
          nl: [{ required: true, message: '年龄不能为空', trigger: 'blur' }],
          zy: [{ required: true, message: '职业不能为空', trigger: 'blur' }],
          rysj: [{ required: true, message: '入院时间不能为空', trigger: 'blur' }],
          cysj: [{ required: true, message: '出院时间不能为空', trigger: 'blur' }],
        },
        checkObject:{}
        }
    },
    computed: {
      ...mapGetters(['optionsList']),
    },
    created() {
      this.setMedincalRecordsFrom(this.medicalRecordsInfo)
      this.readOnly = this.fromtype == '2' ? false : true
    },
    methods: {
      setMedincalRecordsFrom(medicalRecordsFrom){
        this.medicalRecordsFrom = medicalRecordsFrom
        if(this.medicalRecordsFrom.csrq){
          this.medicalRecordsFrom.csrqy = this.medicalRecordsFrom.csrq.substr(0,4)
          this.medicalRecordsFrom.csrqm = this.medicalRecordsFrom.csrq.substr(4,2)
          this.medicalRecordsFrom.csrqd = this.medicalRecordsFrom.csrq.substr(6,2)
        }
        this.getCheckObject(medicalRecordsFrom)
      },
      getCheckObject(medicalRecordsFrom){
        let n = 1;
        let qualityControlList = medicalRecordsFrom.qualityControlList
        if(qualityControlList && qualityControlList.length > 0){
          for(let i=0;i<qualityControlList.length;i++){
            let qualityControlResultModelList = qualityControlList[i].qualityControlResultModelList
            for(let j=0;j<qualityControlResultModelList.length;j++){
              let checkData = {label:n,content:qualityControlResultModelList[j].ruleRemindMessage, visible : false}
              this.checkObject[qualityControlResultModelList[j].checkFieldCode] = checkData
              n++
            }
          }
        }
      },
      upCheckObjectVisible(objectKey,key){
        let visible = this[objectKey][key].visible
        if(!visible){
          Object.keys(this[objectKey]).forEach(keys => {
            this[objectKey][keys].visible = visible
          });
        }
        this[objectKey][key].visible = !visible
      }
    }
  }
  </script>
  
  <style scoped="scoped" lang="scss">
    .top-title {
      padding: 0px;
      text-align: center;
      height: 50px; /* 设置div高度 */
      width:100%;
      font-size: 30px;
    }
    ::v-deep .el-input__wrapper {
      box-shadow: none;
      // border-bottom: 1px solid #000; /* 添加底部边框 */
      position: relative; /* 设置定位，伪元素将基于此定位 */
      border-radius : 0;
      text-align: center;
    }
    ::v-deep .el-input__inner {
      text-align: center;
    }
    ::v-deep .el-input.is-disabled .el-input__wrapper{
      background-color: #ffffff;
      box-shadow: none;
    }
    ::v-deep .el-select:hover:not(.el-select--disabled) .el-input__wrapper {
      box-shadow: none;
    }
    ::v-deep .el-select__wrapper {
      box-shadow: none;
  }
    ::v-deep .el-form-item__label {
      padding: 5px;
    }
    ::v-deep .el-select .el-input.is-disabled .el-input__wrapper:hover {
      box-shadow: none;
    }
    ::v-deep .el-form-item {
      display: flex;
      --font-size: 14px;
      margin-bottom: 8px;
    }
    ::v-deep .el-input.is-disabled .el-input__inner {
      -webkit-text-fill-color: #000000;
   }
   ::v-deep .el-select__wrapper.is-disabled {
      background-color: #ffffff;
   }
   ::v-deep .el-select__wrapper.is-disabled .el-select__selected-item {
      color: #000000;
  }
  </style>
  